package com.starview.star.compiler.cafe.compile;

import org.objectweb.asm.ClassWriter;

/**
 * Version of {@link ClassWriter} appropriate for use with the Star compiler.
 */
class CafeClassWriter extends ClassWriter
{
  // static {
  // ClassWriter.MAX_CODE_LENGTH = 16484;
  // }

  public CafeClassWriter()
  {
    super(ClassWriter.COMPUTE_FRAMES,
        new org.objectweb.asm.commons.splitlarge.SplitMethodWriterDelegate());
  }

  /**
   * This override keeps ASM from trying to classload the auto-generated function types.
   */
  @Override
  protected String getCommonSuperClass(final String type1, final String type2)
  {
    if (type1.equals("com/starview/platform/data/IValue") || type2.equals("com/starview/platform/data/IValue"))
      return "com/starview/platform/data/IValue";
    else
      return "java/lang/Object";
  }
}